﻿using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;

namespace Lapcounter
{
    class IOHelper
    {
        #region Private declarations

        private static SerialPort _port;       //Serial port
        const int BAUDRATE = 9600;      //Baud-Rate of the serial port (must be the same value on Arduino Serial.begin-Method
        const string COMPORT = "COM5";  //Name of the port

        #endregion

        internal static void SoundHorn(int duration)
        {
            _port = new SerialPort(COMPORT) { BaudRate = BAUDRATE };
            _port.Open();
            _port.Write(string.Format("{0}\n", duration));
            _port.Close();
        }
    }
}
